package com.situ.student.service.impl;

import com.situ.student.dao.SubjectDao;
import com.situ.student.dao.impl.SubjectDaoImpl;
import com.situ.student.model.Subject;
import com.situ.student.service.SubjectService;
import com.situ.student.util.BeanFactory;
import com.situ.student.util.Pagination;

import java.util.List;

public class SubjectServiceImpl implements SubjectService {
    private final SubjectDao subjectDao = BeanFactory.getBean(SubjectDaoImpl.class);
    @Override
    public List<Subject> findAll(Pagination pagination, Subject subject) {
        return subjectDao.findAll(pagination, subject);
    }

    @Override
    public int deleteByIds(int id) {
        return subjectDao.deleteByIds(id);
    }

    @Override
    public boolean save(Subject subject) {
        return subjectDao.save(subject)==1;
    }

    @Override
    public boolean update(Subject subject) {
        return subjectDao.update(subject)==1;
    }

    @Override
    public Subject findById(Integer id) {
        return subjectDao.findById(id);
    }


}
